package com.code.design.model.demo.decorator.decorator;

import com.code.design.model.demo.decorator.component.Car;

/**
 * 装饰器的抽象类，也就是Decorator角色，这个角色包含了被装饰的成员对象
 * <p>
 * 继承自Car接口，可以让每一个装饰器本身也可以被更外层的装饰器所包装，包装的方式就是把Car对象作为参数，传入到外层装饰器的构造函数当中。
 *
 * @author tangyifei
 */
public class CarDecorator implements Car {

    protected Car decoratedCar;

    public CarDecorator(Car decoratedCar) {
        this.decoratedCar = decoratedCar;
    }

    @Override
    public void run() {
        decoratedCar.run();
    }
}
